import 'package:flutter/material.dart';
import 'package:get/get.dart';

showGetDialog(Widget child,
    {double margin: 50, bool barrierDismissible: false}) {
  Get.dialog(
      Column(
        mainAxisSize: MainAxisSize.min, //居中  并且是最小布局  可以点击遮罩层
        //Material外面可以使用组件 不能有样式
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          Material(
              color: Colors.transparent,
              child: Center(
                child: Container(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    mainAxisSize: MainAxisSize.min,
                    children: [child],
                  ),
                  margin: EdgeInsets.symmetric(horizontal: margin),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(8),
                      color: Colors.white),
                ),
              ))
        ],
      ),
      barrierDismissible: barrierDismissible, //是否可以通过空白点击
      barrierColor: Colors.black54.withOpacity(0.3));
}
